/**
 * com.cnhis.his.customer.service.Rab1Service.java
 */
package com.mbmed.doctor.homepage.service;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.FormParam;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Request;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.mbmed.doctor.homepage.bo.Rab1Bo;
import com.mbmed.doctor.homepage.mapper.Rab1;

/**
 * @file  Rab1Service.java
 * @author 刘武
 * @version 0.1
 * @todo	Rab1服务操作接口
 * Copyright(C), 2013-2014
 *		 Shenzhen Coordinates Software Development Co., Ltd.
 * History
 *   	1. Date: 2014-10-15 11:15:52
 *      	Author: 刘武
 *      	Modification: this file was created
 *   	2. ...
 */
@Path("/rab1")
@Component
public class Rab1Service {
	
	private static Logger logger = Logger.getLogger(Rab1.class);
	
	@Autowired
	private Rab1Bo rab1Bo;
	
	@Context
	Request request;

	
	/**
	 * 查找所有数据库记录
     * @return type : List 返回查询操作所有符合条件的记录的VO对象集合，操作失败返回null
     */
	@GET
	@Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON})
    public List<Rab1> getAll() throws Exception{
        List<Rab1> list = new ArrayList<Rab1>();
        return rab1Bo.getAll();        
    }
	
    /**
     * 查找符合条件的所有数据库记录
     * @param id 与数据库中主键对应的值
     * @return type :  返回查询操作所有符合条件的记录的VO对象，操作失败返回null
     * @throws Exception
     */
	@GET
	@Path("{id}")
	@Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON})
    public Rab1 getRab1(@PathParam("id") String id) throws Exception{
    	Rab1 rab1 = null;
    	return rab1Bo.get(id);        
    }
    /**
     * 向数据库中插入一条记录
     * @param vo 与数据库中记录对应的值对象
     * @return type : 返回插入操作是否成功
     * @throws Exception
     */
	@POST
	@Produces(MediaType.APPLICATION_JSON)
	@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
	public Rab1 saveRab1(
			@FormParam("rab01") java.lang.Integer rab01,
			@FormParam("vaa07") java.lang.Integer vaa07,
			@FormParam("rab03") java.util.Date rab03,
			@FormParam("bak02") java.lang.String bak02,
			@FormParam("bak05") java.lang.String bak05,
			@FormParam("bce03a") java.lang.String bce03a,
			@FormParam("bce03b") java.lang.String bce03b,
			@FormParam("bce03c") java.lang.String bce03c,
			@FormParam("rab09") java.lang.String rab09,
			@FormParam("aab01") java.lang.String aab01,
			@FormParam("abd01") java.lang.String abd01,
			@FormParam("bce03d") java.lang.String bce03d,
			@FormParam("rab13") java.lang.Byte rab13,
			@FormParam("ach01") java.lang.String ach01,
			@FormParam("acz01") java.lang.String acz01,
			@FormParam("rab16") java.lang.Integer rab16,
			@FormParam("rab17") java.util.Date rab17,
			@FormParam("rab18") java.util.Date rab18,
			@FormParam("rab19") java.util.Date rab19,
			@FormParam("rab20") java.util.Date rab20,
			@FormParam("bjx01") java.lang.String bjx01,
			@FormParam("bjy01") java.lang.String bjy01,
			@FormParam("rab23") java.lang.Byte rab23,
			@FormParam("rab24") java.lang.String rab24,
			@FormParam("rab25") java.lang.Byte rab25,
			@FormParam("rab26") java.lang.Byte rab26,
			@FormParam("rab27") java.lang.String rab27,
			@FormParam("rab28") java.lang.Byte rab28,
			@FormParam("rab29") java.lang.Integer rab29,
			@FormParam("rab30") java.lang.Byte rab30,
			@FormParam("rab31") java.lang.Byte rab31,
			@FormParam("rab32") java.lang.Byte rab32,
			@FormParam("rab33") java.lang.String rab33,
			@Context HttpServletResponse servletResponse
	) throws Exception {
		Rab1 rab1 = new Rab1();
		rab1.setRab01(rab01);
		rab1.setVaa07(vaa07);
		rab1.setRab03(rab03);
		rab1.setBak02(bak02);
		rab1.setBak05(bak05);
		rab1.setBce03a(bce03a);
		rab1.setBce03b(bce03b);
		rab1.setBce03c(bce03c);
		rab1.setRab09(rab09);
		rab1.setAab01(aab01);
		rab1.setAbd01(abd01);
		rab1.setBce03d(bce03d);
		rab1.setRab13(rab13);
		rab1.setAch01(ach01);
		rab1.setAcz01(acz01);
		rab1.setRab16(rab16);
		rab1.setRab17(rab17);
		rab1.setRab18(rab18);
		rab1.setRab19(rab19);
		rab1.setRab20(rab20);
		rab1.setBjx01(bjx01);
		rab1.setBjy01(bjy01);
		rab1.setRab23(rab23);
		rab1.setRab24(rab24);
		rab1.setRab25(rab25);
		rab1.setRab26(rab26);
		rab1.setRab27(rab27);
		rab1.setRab28(rab28);
		rab1.setRab29(rab29);
		rab1.setRab30(rab30);
		rab1.setRab31(rab31);
		rab1.setRab32(rab32);
		rab1.setRab33(rab33);

		return rab1 = rab1Bo.save(rab1);

	}
	/**
     * 删除数据库中与传入的值对象对应的记录
     * @param vo 与数据库中记录对应的值对象
     * @return type : boolean 返回删除操作是否成功
     * @throws Exception
     */
	@DELETE
	@Path("{id}")
	public boolean removeRab1(@PathParam("id") String id) throws Exception{
		if(id == null) return false;
    	return rab1Bo.remove(id);

	}
	
}
